class Stack {
    private items: number[] = [];
    push(element: number) {
        this.items.push(element);
    }
// 栈的后进先出原则，从栈顶出栈
    pop(): number {
        return this.items.pop();
    }
}

let stack = new Stack();
stack.push(1)
stack.push(2)
stack.push(2)
stack.pop()
console.log(stack)
